import Vue from 'vue'
import Router from 'vue-router'
// import recommend from 'components/recommend/recommend'//推荐 
// import rank from 'components/rank/rank'//排行
// import singer from 'components/singer/singer'//歌手
// import search from 'components/search/search'//搜索
// import SingerDetail from 'components/singer-detail/singer-detail'//歌手详情页
// import Disc from '@/components/disc/disc' //歌单界面
// import TopList from '@/components/top-list/top-list'//排行榜列表页
// import UserCenter from '@/components/user-center/user-center'//用户中心组件
Vue.use(Router)

export default new Router({ 
  linkActiveClass: 'active',
	mode:'history',
  routes: [
    {
    	path:"/",         //推荐 
			redirect:"/recommend"//重定向//重定向
    },
		{
      path: '/recommend',
      component:()=>import('components/recommend/recommend'),
      children:[ 
        {path:':id',component:()=>import('components/disc/disc')}
      ]
    },
		{
      path:'/singer', //歌手
      component:()=>import('components/singer/singer'),
			children:[
				{
					path:':id',
					component: ()=>import('components/singer-detail/singer-detail')
				}
			]
    },
		{
      path: '/rank', //排行
      component:()=>import('components/rank/rank') ,
			children: [
				{
					path: ':id',
					component: ()=>import('components/top-list/top-list')
				}
			]
    },
		{
      path: '/search',  //搜索
      component:()=>import('components/search/search'),
			children:[
				{
					path:':id',
					component: ()=>import('components/singer-detail/singer-detail')
				}
			] 
    },
		{
      path: '/user',  //用户界面
      component:()=>import('components/user-center/user-center'),
    }
  ]
})

//路由懒加载
// const Recommend = (resolve) => {
//   import('components/recommend/recommend').then((module) => {
//     resolve(module)
//   })
// }
// 
// const Singer = (resolve) => {
//   import('components/singer/singer').then((module) => {
//     resolve(module)
//   })
// }
// 
// const Rank = (resolve) => {
//   import('components/rank/rank').then((module) => {
//     resolve(module)
//   })
// }
// 
// const Search = (resolve) => {
//   import('components/search/search').then((module) => {
//     resolve(module)
//   })
// }
// 
// const SingerDetail = (resolve) => {
//   import('components/singer-detail/singer-detail').then((module) => {
//     resolve(module)
//   })
// }
// 
// const Disc = (resolve) => {
//   import('components/disc/disc').then((module) => {
//     resolve(module)
//   })
// }
// 
// const TopList = (resolve) => {
//   import('components/top-list/top-list').then((module) => {
//     resolve(module)
//   })
// }
// 
// const UserCenter = (resolve) => {
//   import('components/user-center/user-center').then((module) => {
//     resolve(module)
//   })
// }
// 
// export default new Router({ 
//   linkActiveClass: 'active',
// 	mode:'history',
//   routes: [
//     {
//     	path:"/",         //推荐 
//     	redirect:"/recommend"//重定向
//     },
// 		{
//       path: '/recommend',
//       component:Recommend,
//       children:[ 
//         {path:':id',component:Disc}
//       ]
//     },
// 		{
//       path:'/singer', //歌手
//       component:Singer,
// 			children:[
// 				{
// 					path:':id',
// 					component: SingerDetail
// 				}
// 			]
//     },
// 		{
//       path: '/rank', //排行
//       component:Rank ,
// 			children: [
// 				{
// 					path: ':id',
// 					component: TopList
// 				}
// 			]
//     },
// 		{
//       path: '/search',  //搜索
//       component:Search,
// 			children:[
// 				{
// 					path:':id',
// 					component: SingerDetail
// 				}
// 			] 
//     },
// 		{
//       path: '/user',  //用户界面
//       component:UserCenter,
//     }
//   ]
// })
// 